<?php
namespace app\api\validate;
use think\Validate;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/21 0021
 * Time: 14:35
 */
class LoginValidate extends Validate
{
    protected $rule = [
        'tel' => ['require','/^1[34578]\d{9}$/','unique:iuser'],
        'code' => 'require|number',
        'name' => 'require',
];
    protected $message = [
        'tel.require' => '手机号码必填',
        'tel.unique' => '手机号码已被注册',
        'tel' => '手机格式不正确',
        'code.require' => '验证码不能为空',
        'code.number' => '验证码格式不正确',
    ];
    protected $scene = [
        'login' => ['tel'=>['/^1[34578]\d{9}$/','require'],'name','code'],
        'vertify' => ['tel'],
        'consult' => ['tel'=>['/^1[34578]\d{9}$/','require']]

    ];
}